{% include 'header.html' %}
<div id="Main">
	<div id="Nav"><img src="/static/shared/home.png" align="absmiddle" class="ico16" />&nbsp;<a href="/writer/overview?page={{ page }}">Picky Backend</a> &nbsp;›&nbsp; {% ifequal page_mode 'new' %}New Article{% endifequal %}{% ifequal page_mode 'edit' %}Edit Article &nbsp;›&nbsp; {{ article.key }}{% endifequal %}</div>
	{% if message %}
	<div id="Message"><img src="/static/shared/minus.png" align="absmiddle" class="ico16" /> {{ message }}</div>
	{% endif %}
	<div id="Composing">
	{% ifequal page_mode 'edit' %}
	<form method="post" action="/writer/update/{{ article.key}}" name="formWrite">
	<small class="fade">The article you're editing is created on {{ article.created|date:"r" }}, has {{ article.hits }} hits.<br /><a href="/{{ article.title_url }}" target="_blank">Open in a new tab  »&nbsp;</a></small>
	<br /><br />
	{% else %}
	<form method="post" action="/writer/save" name="formWrite">
	{% endifequal %}
	Title<br />
	<input type="text" class="sl" name="title" value="{% if article.title %}{{ article.title|escape }}{% endif %}" />
	<br /><br />
	Title Link<br />
	<input type="text" class="sl" name="title_link" value="{% if article.title_link %}{{ article.title_link|escape }}{% endif %}" />
	<br /><br />
	Title URL<br />
	<input type="text" class="sl" name="title_url" value="{% if article.title_url %}{{ article.title_url|escape }}{% endif %}" />
	<br /><br />
	Parent URL<br />
	<input type="text" class="sl" name="parent_url" value="{% if article.parent_url %}{{ article.parent_url|escape }}{% endif %}" />
	<br /><br />
	{% if message %}
	<strong>Content <span class="snow">Required</span></strong>
	{% else %}
	Content
	{% endif %}
	<br />
	<textarea class="ml" id="editor" name="content" style="width:600px;">{% if article.content %}{{ article.content|escape }}{% endif %}</textarea>
	<script src="http://a.tbcdn.cn/s/kissy/1.1.7/??kissy-min.js,uibase/uibase-pkg-min.js,dd/dd-pkg-min.js,overlay/overlay-pkg-min.js,editor/editor-all-pkg-min.js"></script> 
	<script src="http://a.tbcdn.cn/s/kissy/1.1.7/editor/biz/ext/editor-plugin-pkg-min.js"></script> 
	<script type="text/javascript"> 
		KISSY.ready(function(S) {			
			S.use('editor', function(S) {
				var KE = KISSY.Editor;		 
				window.editor = KE("#editor", {
					attachForm:true,
					baseZIndex:10000,		 
					pluginConfig: {
						"image":{
							upload:{
								serverUrl:"http://8.yuntongbu.sinaapp.com/sina/add.php",
								fileInput:"imgFile",
								sizeLimit:1000,//k
								extraHtml:"<p style='margin-top:5px;'><input type='checkbox' checked='checked' id='ke_img_up_watermark_1' style='vertical-align:middle;'> 图片加水印，防止别人盗用</p>"
							}
						},
						"font-size":{
							items:[
								{
									value:"14px",
									attrs:{
										style:'position: relative; border: 1px solid #DDDDDD; margin: 2px; padding: 2px;'
									},
									name:"" +
											" <span style='font-size:14px'>标准</span>" +
											"<span style='position:absolute;top:1px;right:3px;'>14px</span>"
								},
								{
									value:"16px",
									attrs:{
										style:'position: relative; border: 1px solid #DDDDDD; margin: 2px; padding: 2px;'
									},
									name:"" +
											" <span style='font-size:16px'>大</span>" +
											"<span style='position:absolute;top:1px;right:3px;'>16px</span>"
								},
								{
									value:"18px",
									attrs:{
										style:'position: relative; border: 1px solid #DDDDDD; margin: 2px; padding: 2px;'
									},
									name:"" +
											" <span style='font-size:18px'>特大</span>" +
											"<span style='position:absolute;top:1px;right:3px;'>18px</span>"
								},
								{
									value:"20px",
									attrs:{
										style:'position: relative; border: 1px solid #DDDDDD; margin: 2px; padding: 2px;'
									},
									name:"" +
											" <span style='font-size:20px'>极大</span>" +
											"<span style='position:absolute;top:1px;right:3px;'>20px</span>"
								}
							],
							width:"115px"
						}
						,"font-family":{
							items:[
								{name:"宋体",value:"SimSun"},
								{name:"黑体",value:"SimHei"},
								{name:"楷体",value:"KaiTi_GB2312"},
								{name:"微软雅黑",value:"Microsoft YaHei"},
								{name:"Times New Roman",value:"Times New Roman"},
								{name:"Arial",value:"Arial"},
								{name:"Verdana",value:"Verdana"}
							]
						}
						,"video":{
							urlCfg:[
								{
									reg:/tudou\.com/i,
									url:"http://bangpai.taobao.com/json/getTudouVideo.htm?" +
											"url=@url@&callback=@callback@"//"&rand=@rand@"
								}
							],
							urlTip:"请输入优酷网、土豆网、酷6网的视频播放页链接...",
							providers:[
								{
									reg:/youku\.com/i,
									width:480,
									height:400,
									detect:function(url) {
										var m = url.match(/id_([^.]+)\.html$/);
										if (m) {
											return "http://player.youku.com/player.php/sid/" + m[1] + "/v.swf";
										}
										m = url.match(/v_playlist\/([^.]+)\.html$/);
										if (m) {
											return;
											//return "http://player.youku.com/player.php/sid/" + m[1] + "/v.swf";
										}
										return url;
									}
								},
								{
									reg:/tudou\.com/i,
									width:480,
									height:400,
									detect:function(url) {
										return url;
									}
								},
								{
									reg:/ku6\.com/i,
									width:480,
									height:400,
									detect:function(url) {
										var m = url.match(/show[^\/]*\/([^.]+)\.html$/);
										if (m) {
											return "http://player.ku6.com/refer/" + m[1] + "/v.swf";
										}
										return url;
									}
								}/*,
								 {
								 reg:/taobaocdn\.com/i,
								 width:480,
								 height:400,
								 detect:function(url) {
								 return url;
								 }
								 }*/
							]
						},
						"draft":{
							interval:5,
							limit:10,
							helpHtml:  "<div " +
									"style='width:200px;'>" +
									"<div style='padding:5px;'>草稿箱能够自动保存您最新编辑的内容," +
									"如果发现内容丢失" +
									"请选择恢复编辑历史</div></div>"
						},
						"resize":{
							direction:["y"]
						}
					}
				}).use("htmldataprocessor,enterkey,clipboard," +
						"sourcearea,checkbox-sourcearea,preview," +
						"separator," +
						"undo,separator,removeformat,font,color,separator," +
						"list,indent,justify,separator,link,image,video,xiami-music,smiley," +
						"separator,table,resize,draft,maximize"
						, function() {
							var self = this,
									htmlDataProcessor = self.htmlDataProcessor,
									dataFilter = htmlDataProcessor && htmlDataProcessor.dataFilter;
							if (dataFilter) {
								dataFilter.addRules({
									attributes:{
										style:function(value) {
											value = value.replace(/background-color\s*:[^;]+(;|$)/g, "")
													.replace(/background\s*:[^;]+(;|$)/g, "");
											if (!value) return false;
											return value;
										}
									}
								});
							}
						});
		 
		 
			});
		});
	</script> 
	<br /><br />
	Set<br />
	<input type="text" class="sl" name="article_set" value="{% if article.article_set %}{{ article.article_set|escape }}{% endif %}" />
	<br /><br />
	Format<br />
	{% ifequal page_mode 'new' %}
	<select name="format">
		{% ifequal site_default_format 'html' %}
		<option value="html" selected="selected">HTML</option>
		{% else %}
		<option value="html">HTML</option>
		{% endifequal %}
		{% ifequal site_default_format 'markdown' %}
		<option value="markdown" selected="selected">Markdown</option>
		{% else %}
		<option value="markdown">Markdown</option>
		{% endifequal %}
		{% ifequal site_default_format 'txt' %}
		<option value="txt" selected="selected">Plain Text</option>
		{% else %}
		<option value="txt">Plain Text</option>
		{% endifequal %}
	</select>
	{% else %}
	<select name="format">
		{% ifequal article.format 'html' %}
		<option value="html" selected="selected">HTML</option>
		{% else %}
		<option value="html">HTML</option>
		{% endifequal %}
		{% ifequal article.format 'markdown' %}
		<option value="markdown" selected="selected">Markdown</option>
		{% else %}
		<option value="markdown">Markdown</option>
		{% endifequal %}
		{% ifequal article.format 'txt' %}
		<option value="txt" selected="selected">Plain Text</option>
		{% else %}
		<option value="txt">Plain Text</option>
		{% endifequal %}
	</select>
	{% endifequal %}
	<br /><br />
	<small>Is Page: {% if article.is_page %}
	<select name="is_page"><option value="True" selected="selected">Yes</option><option value="False">No</option></select>
	{% else %}
	<select name="is_page"><option value="True">Yes</option><option value="False" selected="selected">No</option></select>
	{% endif %}</small>
	<br /><br />
	<small>Is for Sidebar: {% if article.is_for_sidebar %}
	<select name="is_for_sidebar"><option value="True" selected="selected">Yes</option><option value="False">No</option></select>
	{% else %}
	<select name="is_for_sidebar"><option value="True">Yes</option><option value="False" selected="selected">No</option></select>
	{% endif %}</small>
	<br /><br />
	<button class="super normal button" id="doSubmit" name="button_publish" type="submit">Save</button>&nbsp;&nbsp;{% ifequal page_mode 'edit' %}<a class="super normal button" id="doDelete" href="#;" onclick="if (confirm('Are you sure?')) { location.href = '/writer/remove/{{ article.key }}';}">Delete</a>{% else %}<a class="super normal button" id="doDiscard" href="/writer/overview?page={{ page }}">Discard</a>{% endifequal %}
	</form>
	</div>
	<div id="Explaination">
		<strong>COMPOSING TIPS</strong>
		<div class="sep20"></div>
		<big>TITLE LINK</big> › For pointing to an external URL you want to share with your readers. When readers click TITLE, they will be redirected to TITLE LINK. You can leave this field alone.
		<div class="sep20"></div>
		<big>TITLE URL</big> › This is part of permalink, for example if your site URL is example.com then TITLE URL is used in <big>example.com/title-url</big> , you can have anything here, but - (hyphens) are recommended for replacing spaces in URL.
		<div class="sep20"></div>
		<big>PARENT URL</big> › You can put another article's TITLE URL here, then you'll create a hierarchy-like relationship for them.
		<div class="sep20"></div>
		<big>SET</big> › If you want this article appears in other articles' Related Articles section, you can use same SET to get them organized. Currently articles can be related with ONLY ONE set.
	</div>
	<div class="c"></div>
</div>
{% include 'footer.html' %}
</body>
</html>